﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ATM_Group3.Presentation
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            Session["CardNumber"] = txtCardNumber.Text;
            Session["PIN"] = txtPIN.Text;
            Data.Card obj = new Data.Card();
            BUS.CardBUS db = new BUS.CardBUS();
            obj.CARDID = txtCardNumber.Text;
            if (db.CheckCard(obj) == true)
            {
                if (Session["PIN"].ToString() == db.Getpin(obj))
                {
                    Response.Redirect("Main.aspx");
                }
                else
                {
                    Session["Error"] = "Pin";
                    Response.Redirect("Login.aspx");
                    
                }
            }
            else
            {
                Session["Error"] = "CardID";
                Response.Redirect("Login.aspx");
                
            }
        }

        protected void Button6_Click(object sender, EventArgs e)
        {

        }

        protected void btn1_Click(object sender, EventArgs e)
        {
            if (txtCardNumber.Text.Length < 8)
            {
                txtCardNumber.Text = txtCardNumber.Text + "1";
            }
            else if (txtCardNumber.Text.Length >= 8)
            {
                txtPIN.Text = txtPIN.Text + "1";
                if (txtPIN.Text.Length == 8)
                {

                }
            }
        }
    }
}